/*
*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2011-2018 ARM or its affiliates
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#if !defined(__IMX290_SENSOR_H__)
#define __IMX290_SENSOR_H__


/*-----------------------------------------------------------------------------
Initialization sequence - do not edit
-----------------------------------------------------------------------------*/

#include "sensor_init.h"

/* mclk:37.125MHz */

/*
 * bayer = BAYER_RGGB
 */
static acam_reg_t linear_1080p_30fps_222Mbps_4lane_12bits[] = {
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 5},

    {0x3005, 0x01, 0xff, 1}, //0:10bit 1:12bit
    {0x3007, 0x00, 0xff, 1}, //full hd 1080p
    {0x3009, 0x12, 0xff, 1},
    {0x300a, 0xF0, 0xff, 1}, //black level
    {0x300B, 0x00, 0xff, 1},
    {0x300c, 0x00, 0xff, 1},
    {0x300F, 0x00, 0xff, 1},
    {0x3010, 0x21, 0xff, 1},
    {0x3012, 0x64, 0xff, 1},
    {0x3013, 0x00, 0xff, 1},
    {0x3014, 0x00, 0xff, 1},//Gain
    {0x3016, 0x09, 0xff, 1},
    {0x3018, 0x65, 0xff, 1}, /* VMAX[7:0] */
    {0x3019, 0x04, 0xff, 1}, /* VMAX[15:8] */
    {0x301a, 0x00, 0xff, 1}, /* VMAX[16] */
    {0x301b, 0x00, 0xff, 1},
    {0x301c, 0x30, 0xff, 1}, /* HMAX[7:0] */
    {0x301d, 0x11, 0xff, 1}, /* HMAX[15:8] */
    {0x3020, 0x81, 0xff, 1},//SHS1
    {0x3021, 0x01, 0xff, 1},
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0x00, 0xff, 1},//SHS2
    {0x3025, 0x00, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0x00, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1
    {0x3045, 0x01, 0xff, 1},//DOL
    {0x3046, 0xe1, 0xff, 1},//LANE CHN
    {0x304b, 0x00, 0xff, 1},
    //{0x3418, 0x5e, 0xff, 1},//Y_out size, tools should modify from B2 to 9C
    //{0x3419, 0x09, 0xff, 1},//Y_out size

    {0x305C, 0x18, 0xff, 1},
    {0x305D, 0x03, 0xff, 1},
    {0x305E, 0x20, 0xff, 1},
    {0x305F, 0x01, 0xff, 1},

    {0x3070, 0x02, 0xff, 1}, //must set
    {0x3071, 0x11, 0xff, 1},
    {0x309B, 0x10, 0xff, 1},
    {0x309C, 0x22, 0xff, 1},
    {0x30A2, 0x02, 0xff, 1},
    {0x30A6, 0x20, 0xff, 1},
    {0x30A8, 0x20, 0xff, 1},
    {0x30AA, 0x20, 0xff, 1},
    {0x30AC, 0x20, 0xff, 1},
    {0x30B0, 0x43, 0xff, 1},

    {0x3106, 0x00, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x3119, 0x9e, 0xff, 1},
    {0x311c, 0x1e, 0xff, 1},
    {0x311e, 0x08, 0xff, 1},

    {0x3128, 0x05, 0xff, 1},

    {0x3129, 0x00, 0xff, 1},

    {0x313D, 0x83, 0xff, 1},
    {0x3150, 0x03, 0xff, 1},
    {0x315E, 0x1A, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1A, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317C, 0x00, 0xff, 1},
    {0x317E, 0x00, 0xff, 1},

    {0x31EC, 0x0E, 0xff, 1},

    {0x32B8, 0x50, 0xff, 1},
    {0x32B9, 0x10, 0xff, 1},
    {0x32BA, 0x00, 0xff, 1},
    {0x32BB, 0x04, 0xff, 1},
    {0x32C8, 0x50, 0xff, 1},
    {0x32C9, 0x10, 0xff, 1},
    {0x32CA, 0x00, 0xff, 1},
    {0x32CB, 0x04, 0xff, 1},

    {0x332C, 0xD3, 0xff, 1},
    {0x332D, 0x10, 0xff, 1},
    {0x332E, 0x0D, 0xff, 1},
    {0x3358, 0x06, 0xff, 1},
    {0x3359, 0xE1, 0xff, 1},
    {0x335A, 0x11, 0xff, 1},
    {0x3360, 0x1E, 0xff, 1},
    {0x3361, 0x61, 0xff, 1},
    {0x3362, 0x10, 0xff, 1},
    {0x33B0, 0x50, 0xff, 1},
    {0x33B2, 0x1A, 0xff, 1},
    {0x33B3, 0x04, 0xff, 1},

    {0x3405, 0x20, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0A, 0xff, 1},
    {0x3415, 0x01, 0xff, 1},
    {0x3418, 0x49, 0xff, 1},
    {0x3419, 0x04, 0xff, 1},
    {0x3441, 0x0C, 0xff, 1},
    {0x3442, 0x0C, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},

    {0x3446, 0x47, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x1F, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344A, 0x17, 0xff, 1},
    {0x344B, 0x00, 0xff, 1},
    {0x344C, 0x0F, 0xff, 1},
    {0x344D, 0x00, 0xff, 1},
    {0x344E, 0x17, 0xff, 1},
    {0x344F, 0x00, 0xff, 1},
    {0x3450, 0x47, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x0F, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x0F, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0x9C, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x347B, 0x24, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0xFFFF, 1},
    {0x3049, 0x0A, 0xff, 1}, /* XVSOUTSEL XHSOUTSEL */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

/*
 * bayer = BAYER_GBRG
 */
static acam_reg_t linear_1080p_50fps_446Mbps_4lane_10bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x00, 0xff, 1},
    {0x3007, 0x00, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0x3c, 0xff, 1},
    //{0x300c, 0x00, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x3010, 0x21, 0xff, 1},
    {0x3012, 0x64, 0xff, 1},
    {0x3014, 0x00, 0xff, 1},
    {0x3016, 0x09, 0xff, 1},
    {0x3018, 0xB8, 0xff, 1},//VMAX change from 04C4 to 05B8, 50fps
    {0x3019, 0x05, 0xff, 1},//VMAX

    {0x301c, 0xEC, 0xff, 1},//* HMAX */ change from 0898 to 07EC
    {0x301d, 0x07, 0xff, 1},//* HMAX */
    {0x3020, 0x02, 0xff, 1},//SHS1
    {0x3021, 0x01, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    //{0x3024, 0xC9, 0xff, 1},//SHS2
    //{0x3025, 0x07, 0xff, 1},//SHS2
    //{0x3026, 0x00, 0xff, 1},//SHS2
    //{0x3030, 0x0B, 0xff, 1},//RHS1
    //{0x3031, 0x00, 0xff, 1},//RHS1
    //{0x3032, 0x00, 0xff, 1},//RHS1
    //{0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x00, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},
    {0x3418, 0x49, 0xff, 1},//Y_out size,1097
    {0x3419, 0x04, 0xff, 1},//Y_out size

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x3070, 0x02, 0xff, 1},
    {0x3071, 0x11, 0xff, 1},

    {0x309b, 0x10, 0xff, 1},
    {0x309c, 0x22, 0xff, 1},

    {0x30a2, 0x02, 0xff, 1},
    {0x30a6, 0x20, 0xff, 1},
    {0x30a8, 0x20, 0xff, 1},
    {0x30aa, 0x20, 0xff, 1},
    {0x30ac, 0x20, 0xff, 1},
    {0x30b0, 0x43, 0xff, 1},

    {0x3106, 0x00, 0xff, 1}, //Need double confirm, H company 11h
    {0x3119, 0x9e, 0xff, 1},
    {0x311c, 0x1e, 0xff, 1},
    {0x311e, 0x08, 0xff, 1},

    {0x3128, 0x05, 0xff, 1},
    {0x3129, 0x1d, 0xff, 1},
    {0x313d, 0x83, 0xff, 1},
    {0x3150, 0x03, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},
    {0x3164, 0x1a, 0xff, 1},
    {0x317c, 0x12, 0xff, 1},
    {0x317e, 0x00, 0xff, 1},
    {0x31ec, 0x37, 0xff, 1},

    {0x32b8, 0x50, 0xff, 1},
    {0x32b9, 0x10, 0xff, 1},
    {0x32ba, 0x00, 0xff, 1},
    {0x32bb, 0x04, 0xff, 1},

    {0x32c8, 0x50, 0xff, 1},
    {0x32c9, 0x10, 0xff, 1},
    {0x32ca, 0x00, 0xff, 1},
    {0x32cb, 0x04, 0xff, 1},

    {0x332c, 0xd3, 0xff, 1},
    {0x332d, 0x10, 0xff, 1},
    {0x332e, 0x0d, 0xff, 1},

    {0x3358, 0x06, 0xff, 1},
    {0x3359, 0xe1, 0xff, 1},
    {0x335a, 0x11, 0xff, 1},

    {0x3360, 0x1e, 0xff, 1},
    {0x3361, 0x61, 0xff, 1},
    {0x3362, 0x10, 0xff, 1},

    {0x33b0, 0x50, 0xff, 1},
    {0x33b2, 0x1a, 0xff, 1},
    {0x33b3, 0x04, 0xff, 1},

    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},

    {0x3441, 0x0a, 0xff, 1},
    {0x3442, 0x0a, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x57, 0xff, 1},
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x37, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x1f, 0xff, 1},

    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x1f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},

    {0x344e, 0x1f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x77, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},

    {0x3452, 0x1f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0x9c, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000}
};

/*
 * bayer = BAYER_GBRG
 */
static acam_reg_t linear_1080p_60fps_446Mbps_4lane_10bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x00, 0xff, 1},
    {0x3007, 0x00, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0x3c, 0xff, 1},
    //{0x300c, 0x00, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x3010, 0x21, 0xff, 1},
    {0x3012, 0x64, 0xff, 1},
    {0x3014, 0x00, 0xff, 1},
    {0x3016, 0x09, 0xff, 1},
    {0x3018, 0xC4, 0xff, 1},//VMAX change to 04C4  60fps
    {0x3019, 0x04, 0xff, 1},//VMAX

    {0x301c, 0xEC, 0xff, 1},//* HMAX */ change from 0898 to 07EC
    {0x301d, 0x07, 0xff, 1},//* HMAX */
    {0x3020, 0x02, 0xff, 1},//SHS1
    {0x3021, 0x01, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    //{0x3024, 0xC9, 0xff, 1},//SHS2
    //{0x3025, 0x07, 0xff, 1},//SHS2
    //{0x3026, 0x00, 0xff, 1},//SHS2
    //{0x3030, 0x0B, 0xff, 1},//RHS1
    //{0x3031, 0x00, 0xff, 1},//RHS1
    //{0x3032, 0x00, 0xff, 1},//RHS1
    //{0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x00, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},
    {0x3418, 0x49, 0xff, 1},//Y_out size,1097
    {0x3419, 0x04, 0xff, 1},//Y_out size

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x3070, 0x02, 0xff, 1},
    {0x3071, 0x11, 0xff, 1},

    {0x309b, 0x10, 0xff, 1},
    {0x309c, 0x22, 0xff, 1},

    {0x30a2, 0x02, 0xff, 1},
    {0x30a6, 0x20, 0xff, 1},
    {0x30a8, 0x20, 0xff, 1},
    {0x30aa, 0x20, 0xff, 1},
    {0x30ac, 0x20, 0xff, 1},
    {0x30b0, 0x43, 0xff, 1},

    {0x3106, 0x00, 0xff, 1}, //Need double confirm, H company 11h
    {0x3119, 0x9e, 0xff, 1},
    {0x311c, 0x1e, 0xff, 1},
    {0x311e, 0x08, 0xff, 1},

    {0x3128, 0x05, 0xff, 1},
    {0x3129, 0x1d, 0xff, 1},
    {0x313d, 0x83, 0xff, 1},
    {0x3150, 0x03, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},
    {0x3164, 0x1a, 0xff, 1},
    {0x317c, 0x12, 0xff, 1},
    {0x317e, 0x00, 0xff, 1},
    {0x31ec, 0x37, 0xff, 1},

    {0x32b8, 0x50, 0xff, 1},
    {0x32b9, 0x10, 0xff, 1},
    {0x32ba, 0x00, 0xff, 1},
    {0x32bb, 0x04, 0xff, 1},

    {0x32c8, 0x50, 0xff, 1},
    {0x32c9, 0x10, 0xff, 1},
    {0x32ca, 0x00, 0xff, 1},
    {0x32cb, 0x04, 0xff, 1},

    {0x332c, 0xd3, 0xff, 1},
    {0x332d, 0x10, 0xff, 1},
    {0x332e, 0x0d, 0xff, 1},

    {0x3358, 0x06, 0xff, 1},
    {0x3359, 0xe1, 0xff, 1},
    {0x335a, 0x11, 0xff, 1},

    {0x3360, 0x1e, 0xff, 1},
    {0x3361, 0x61, 0xff, 1},
    {0x3362, 0x10, 0xff, 1},

    {0x33b0, 0x50, 0xff, 1},
    {0x33b2, 0x1a, 0xff, 1},
    {0x33b3, 0x04, 0xff, 1},

    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},

    {0x3441, 0x0a, 0xff, 1},
    {0x3442, 0x0a, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x57, 0xff, 1},
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x37, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x1f, 0xff, 1},

    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x1f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},

    {0x344e, 0x1f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x77, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},

    {0x3452, 0x1f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0x9c, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t dol_1080p_25fps_4lane_10bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x00, 0xff, 1},
    {0x3007, 0x00, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0x3c, 0xff, 1},
    {0x300c, 0x11, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x3010, 0x21, 0xff, 1},
    {0x3012, 0x64, 0xff, 1},
    {0x3014, 0x00, 0xff, 1},
    {0x3016, 0x09, 0xff, 1},
    {0x3018, 0xB8, 0xff, 1},//VMAX change from 04C4 to 05B8, 25fps
    {0x3019, 0x05, 0xff, 1},//VMAX

    {0x301c, 0xEC, 0xff, 1},//* HMAX */ change from 0898 to 07EC
    {0x301d, 0x07, 0xff, 1},//* HMAX */
    {0x3020, 0x02, 0xff, 1},//SHS1
    {0x3021, 0x01, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0xC9, 0xff, 1},//SHS2
    {0x3025, 0x07, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0x0B, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1
    {0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x00, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},
    {0x3418, 0x9C, 0xff, 1},//Y_out size, tools should modify from B2 to 9C
    {0x3419, 0x08, 0xff, 1},//Y_out size

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x3070, 0x02, 0xff, 1},
    {0x3071, 0x11, 0xff, 1},

    {0x309b, 0x10, 0xff, 1},
    {0x309c, 0x22, 0xff, 1},

    {0x30a2, 0x02, 0xff, 1},
    {0x30a6, 0x20, 0xff, 1},
    {0x30a8, 0x20, 0xff, 1},
    {0x30aa, 0x20, 0xff, 1},
    {0x30ac, 0x20, 0xff, 1},
    {0x30b0, 0x43, 0xff, 1},

    {0x3106, 0x11, 0xff, 1}, //Need double confirm, H company 11h
    {0x3119, 0x9e, 0xff, 1},
    {0x311c, 0x1e, 0xff, 1},
    {0x311e, 0x08, 0xff, 1},

    {0x3128, 0x05, 0xff, 1},
    {0x3129, 0x1d, 0xff, 1},
    {0x313d, 0x83, 0xff, 1},
    {0x3150, 0x03, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},
    {0x3164, 0x1a, 0xff, 1},
    {0x317c, 0x12, 0xff, 1},
    {0x317e, 0x00, 0xff, 1},
    {0x31ec, 0x37, 0xff, 1},

    {0x32b8, 0x50, 0xff, 1},
    {0x32b9, 0x10, 0xff, 1},
    {0x32ba, 0x00, 0xff, 1},
    {0x32bb, 0x04, 0xff, 1},

    {0x32c8, 0x50, 0xff, 1},
    {0x32c9, 0x10, 0xff, 1},
    {0x32ca, 0x00, 0xff, 1},
    {0x32cb, 0x04, 0xff, 1},

    {0x332c, 0xd3, 0xff, 1},
    {0x332d, 0x10, 0xff, 1},
    {0x332e, 0x0d, 0xff, 1},

    {0x3358, 0x06, 0xff, 1},
    {0x3359, 0xe1, 0xff, 1},
    {0x335a, 0x11, 0xff, 1},

    {0x3360, 0x1e, 0xff, 1},
    {0x3361, 0x61, 0xff, 1},
    {0x3362, 0x10, 0xff, 1},

    {0x33b0, 0x50, 0xff, 1},
    {0x33b2, 0x1a, 0xff, 1},
    {0x33b3, 0x04, 0xff, 1},

    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},

    {0x3441, 0x0a, 0xff, 1},
    {0x3442, 0x0a, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x57, 0xff, 1},
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x37, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x1f, 0xff, 1},

    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x1f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},

    {0x344e, 0x1f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x77, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},

    {0x3452, 0x1f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0xA0, 0xff, 1},//Xout size from 079c to 07A0,8/3th's info
    {0x3473, 0x07, 0xff, 1},
    {0x347B, 0x23, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t dol_1080p_30fps_4lane_10bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x00, 0xff, 1},
    {0x3007, 0x00, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0x3c, 0xff, 1},
    {0x300c, 0x11, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x3010, 0x21, 0xff, 1},
    {0x3012, 0x64, 0xff, 1},
    {0x3014, 0x00, 0xff, 1},
    {0x3016, 0x09, 0xff, 1},
    {0x3018, 0xC4, 0xff, 1},//VMAX change from 0465 to 04C4
    {0x3019, 0x04, 0xff, 1},//VMAX

    {0x301c, 0xEC, 0xff, 1},//* HMAX */ change from 0898 to 07EC
    {0x301d, 0x07, 0xff, 1},//* HMAX */
    {0x3020, 0x3c, 0xff, 1},//SHS1
    {0x3021, 0x01, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0xcb, 0xff, 1},//SHS2
    {0x3025, 0x00, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0xc9, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1
    {0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x00, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},
    {0x3418, 0x5e, 0xff, 1},//Y_out size, tools should modify from B2 to 9C
    {0x3419, 0x09, 0xff, 1},//Y_out size

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x3070, 0x02, 0xff, 1},
    {0x3071, 0x11, 0xff, 1},

    {0x309b, 0x10, 0xff, 1},
    {0x309c, 0x22, 0xff, 1},

    {0x30a2, 0x02, 0xff, 1},
    {0x30a6, 0x20, 0xff, 1},
    {0x30a8, 0x20, 0xff, 1},
    {0x30aa, 0x20, 0xff, 1},
    {0x30ac, 0x20, 0xff, 1},
    {0x30b0, 0x43, 0xff, 1},

    {0x3106, 0x11, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x3119, 0x9e, 0xff, 1},
    {0x311c, 0x1e, 0xff, 1},
    {0x311e, 0x08, 0xff, 1},

    {0x3128, 0x05, 0xff, 1},
    {0x3129, 0x1d, 0xff, 1},
    {0x313d, 0x83, 0xff, 1},
    {0x3150, 0x03, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},
    {0x3164, 0x1a, 0xff, 1},
    {0x317c, 0x12, 0xff, 1},
    {0x317e, 0x00, 0xff, 1},
    {0x31ec, 0x37, 0xff, 1},

    {0x32b8, 0x50, 0xff, 1},
    {0x32b9, 0x10, 0xff, 1},
    {0x32ba, 0x00, 0xff, 1},
    {0x32bb, 0x04, 0xff, 1},

    {0x32c8, 0x50, 0xff, 1},
    {0x32c9, 0x10, 0xff, 1},
    {0x32ca, 0x00, 0xff, 1},
    {0x32cb, 0x04, 0xff, 1},

    {0x332c, 0xd3, 0xff, 1},
    {0x332d, 0x10, 0xff, 1},
    {0x332e, 0x0d, 0xff, 1},

    {0x3358, 0x06, 0xff, 1},
    {0x3359, 0xe1, 0xff, 1},
    {0x335a, 0x11, 0xff, 1},

    {0x3360, 0x1e, 0xff, 1},
    {0x3361, 0x61, 0xff, 1},
    {0x3362, 0x10, 0xff, 1},

    {0x33b0, 0x50, 0xff, 1},
    {0x33b2, 0x1a, 0xff, 1},
    {0x33b3, 0x04, 0xff, 1},

    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},

    {0x3441, 0x0a, 0xff, 1},
    {0x3442, 0x0a, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x57, 0xff, 1},
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x37, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x1f, 0xff, 1},

    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x1f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},

    {0x344e, 0x1f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x77, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},

    {0x3452, 0x1f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0xA0, 0xff, 1},//Xout size from 079c to 07A0,8/3th's info
    {0x3473, 0x07, 0xff, 1},
    {0x347B, 0x23, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},

    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t dol_1080p_60fps_4lane_10bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x00, 0xff, 1},
    {0x3007, 0x00, 0xff, 1},
    {0x3009, 0x00, 0xff, 1},
    {0x300a, 0x3c, 0xff, 1},
    {0x300c, 0x11, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x3010, 0x21, 0xff, 1},
    {0x3012, 0x64, 0xff, 1},
    {0x3014, 0x00, 0xff, 1},
    {0x3016, 0x09, 0xff, 1},
    {0x3018, 0xc4, 0xff, 1},//VMAX change from 0465 to 04C4
    {0x3019, 0x04, 0xff, 1},//VMAX

    {0x301c, 0xf6, 0xff, 1},//* HMAX */ change from 0898 to 07EC
    {0x301d, 0x03, 0xff, 1},//* HMAX */
    {0x3020, 0x02, 0xff, 1},//SHS1
    {0x3021, 0x01, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0x49, 0xff, 1},//SHS2
    {0x3025, 0x08, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0xc9, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1
    {0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x00, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},
    {0x3418, 0x5e, 0xff, 1},//Y_out size, tools should modify from B2 to 9C
    {0x3419, 0x09, 0xff, 1},//Y_out size

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x3070, 0x02, 0xff, 1},
    {0x3071, 0x11, 0xff, 1},

    {0x309b, 0x10, 0xff, 1},
    {0x309c, 0x22, 0xff, 1},

    {0x30a2, 0x02, 0xff, 1},
    {0x30a6, 0x20, 0xff, 1},
    {0x30a8, 0x20, 0xff, 1},
    {0x30aa, 0x20, 0xff, 1},
    {0x30ac, 0x20, 0xff, 1},
    {0x30b0, 0x43, 0xff, 1},

    {0x3106, 0x11, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x3119, 0x9e, 0xff, 1},
    {0x311c, 0x1e, 0xff, 1},
    {0x311e, 0x08, 0xff, 1},

    {0x3128, 0x05, 0xff, 1},
    {0x3129, 0x1d, 0xff, 1},
    {0x313d, 0x83, 0xff, 1},
    {0x3150, 0x03, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},
    {0x3164, 0x1a, 0xff, 1},
    {0x317c, 0x12, 0xff, 1},
    {0x317e, 0x00, 0xff, 1},
    {0x31ec, 0x37, 0xff, 1},

    {0x32b8, 0x50, 0xff, 1},
    {0x32b9, 0x10, 0xff, 1},
    {0x32ba, 0x00, 0xff, 1},
    {0x32bb, 0x04, 0xff, 1},

    {0x32c8, 0x50, 0xff, 1},
    {0x32c9, 0x10, 0xff, 1},
    {0x32ca, 0x00, 0xff, 1},
    {0x32cb, 0x04, 0xff, 1},

    {0x332c, 0xd3, 0xff, 1},
    {0x332d, 0x10, 0xff, 1},
    {0x332e, 0x0d, 0xff, 1},

    {0x3358, 0x06, 0xff, 1},
    {0x3359, 0xe1, 0xff, 1},
    {0x335a, 0x11, 0xff, 1},

    {0x3360, 0x1e, 0xff, 1},
    {0x3361, 0x61, 0xff, 1},
    {0x3362, 0x10, 0xff, 1},

    {0x33b0, 0x50, 0xff, 1},
    {0x33b2, 0x1a, 0xff, 1},
    {0x33b3, 0x04, 0xff, 1},

    {0x3405, 0x00, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},

    {0x3441, 0x0a, 0xff, 1},
    {0x3442, 0x0a, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x77, 0xff, 1},
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x67, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x47, 0xff, 1},

    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x37, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},

    {0x344e, 0x3f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0xff, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},

    {0x3452, 0x3f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x37, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0xA0, 0xff, 1},//Xout size from 079c to 07A0,8/3th's info
    {0x3473, 0x07, 0xff, 1},
    {0x347B, 0x23, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},

    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t imx290_test_pattern[] = {
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0x300a, 0x00, 0xff, 1},
    {0x300e, 0x00, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x308c, 0x21, 0xff, 1},
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t settings_context_imx290[] = {
    //stop sequence - address is 0x0000
    { 0x0000, 0x0000, 0x0000, 0x0000 }
};

static acam_reg_t settings_context_imx290_lens_8mm[] = {
    //stop sequence - address is 0x0000
    { 0x0000, 0x0000, 0x0000, 0x0000 }
};

static acam_reg_t settings_context_imx290_lens_4mm[] = {
    //stop sequence - address is 0x0000
    { 0x0000, 0x0000, 0x0000, 0x0000 }
};


static const acam_reg_t *imx290_seq_table[] = {
    linear_1080p_30fps_222Mbps_4lane_12bits,
    linear_1080p_50fps_446Mbps_4lane_10bits,
    linear_1080p_60fps_446Mbps_4lane_10bits,
    dol_1080p_25fps_4lane_10bits,
    dol_1080p_30fps_4lane_10bits,
    dol_1080p_60fps_4lane_10bits,
    imx290_test_pattern,
};

static const acam_reg_t *isp_seq_table[] = {
    settings_context_imx290,
    settings_context_imx290_lens_8mm,
    settings_context_imx290_lens_4mm,
};

#define SENSOR_IMX290_SEQUENCE_DEFAULT_LINEAR_60FPS_DIFF    0
#define SENSOR_IMX290_SEQUENCE_DEFAULT_WDR_1080P_2DOL    1
#define SENSOR_IMX290_SEQUENCE_DEFAULT_LINEAR    0
#define SENSOR_IMX290_SEQUENCE_DEFAULT_WDR_720P    3
#define SENSOR_IMX290_SEQUENCE_DEFAULT_WDR_1080P    4
//#define SENSOR_IMX290_SEQUENCE_DEFAULT_WDR_1080P_DIFF    5
#define SENSOR_IMX290_SEQUENCE_DEFAULT_TEST_PATTERN    6

#define SENSOR_IMX290_CONTEXT_SEQ 0
#endif /* __IMX290_SENSOR_H__ */
